package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.ActivityJoiner;
import com.ruoyi.swimming.domian.SwimmingTicket;
import com.ruoyi.swimming.mapper.ActivityJoinerMapper;
import com.ruoyi.swimming.mapper.SwimmingTicketMapper;
import com.ruoyi.swimming.service.ISwimmingTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 泳票Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class SwimmingTicketServiceImpl extends ServiceImpl<SwimmingTicketMapper, SwimmingTicket> implements ISwimmingTicketService
{
    @Autowired
    private SwimmingTicketMapper swimmingTicketMapper;

    /**
     * 查询泳票
     * 
     * @param id 泳票ID
     * @return 泳票
     */
    @Override
    public SwimmingTicket selectSwimmingTicketById(Long id)
    {
        return swimmingTicketMapper.selectSwimmingTicketById(id);
    }

    /**
     * 查询泳票列表
     * 
     * @param swimmingTicket 泳票
     * @return 泳票
     */
    @Override
    public List<SwimmingTicket> selectSwimmingTicketList(SwimmingTicket swimmingTicket)
    {
        return swimmingTicketMapper.selectSwimmingTicketList(swimmingTicket);
    }

    /**
     * 新增泳票
     * 
     * @param swimmingTicket 泳票
     * @return 结果
     */
    @Override
    public int insertSwimmingTicket(SwimmingTicket swimmingTicket)
    {
        swimmingTicket.setCreateTime(DateUtils.getNowDate());
        return swimmingTicketMapper.insert(swimmingTicket);
    }

    /**
     * 修改泳票
     * 
     * @param swimmingTicket 泳票
     * @return 结果
     */
    @Override
    public int updateSwimmingTicket(SwimmingTicket swimmingTicket)
    {
        swimmingTicket.setUpdateTime(DateUtils.getNowDate());
        return swimmingTicketMapper.updateById(swimmingTicket);
    }

    /**
     * 批量删除泳票
     * 
     * @param ids 需要删除的泳票ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketByIds(Long[] ids)
    {
        return swimmingTicketMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除泳票信息
     * 
     * @param id 泳票ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketById(Long id)
    {
        return swimmingTicketMapper.deleteById(id);
    }
}
